Experiments in Plant-Hybridization
Gregor Mendel
Introduction
Gregor Johann Mendel (1822 - 1884) was a German-Czech, Augustinian friar and abbot of St. Thomas’ Abbey in Brno (Brünn). He also grew some Peas (Pisum sativum) in his gardens/greenhouses and studied the inheritance of 7 traits which, when crossed, had a dominant form which was exhibited by all of the F1 hybrids, and a recessive form which reappeared in the F2 offspring from selfed F1 hybrids.
Prepare Data
# Prep data
myCaption1 <- "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/"
myCaption2 <- "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/ | Data: Mendel (1865)"
#
d1 <- read_xlsx("data_mendel.xlsx", "T1") %>%
mutate(Trait = factor(Trait, levels = unique(.$Trait)))
d2 <- read_xlsx("data_mendel.xlsx", "T2") %>%
mutate(Trait = factor(Trait, levels = unique(.$Trait)))
d3 <- read_xlsx("data_mendel.xlsx", "T3") %>%
mutate(Trait = factor(Trait, levels = unique(.$Trait)))
#
p1 <- read_xlsx("data_mendel.xlsx", "P1", range = "A5:E9") %>%
mutate(Row = factor(Row, levels = c("2","1")),
P1 = factor(P1), P2 = factor(P2),
XX = factor(XX, levels = c("AA","Aa","aa")))
p2 <- read_xlsx("data_mendel.xlsx", "P2", range = "A5:E9") %>%
mutate(Row = factor(Row, levels = c("2","1")),
P1 = factor(P1, levels = c("A","a")),
P2 = factor(P2, levels = c("A","a")),
XX = factor(XX, levels = c("AA","Aa","aa")))
p3 <- read_xlsx("data_mendel.xlsx", "P3", range = "A5:E9") %>%
mutate(Row = factor(Row, levels = c("2","1")),
P2 = factor(P2),
P1 = factor(P1, levels = c("A","a")),
XX = factor(XX, levels = c("AA","Aa","aa")))
p4 <- read_xlsx("data_mendel.xlsx", "P4", range = "A5:E9") %>%
mutate(Row = factor(Row, levels = c("2","1")),
P1 = factor(P1),
P2 = factor(P2, levels = c("A","a")),
XX = factor(XX, levels = c("AA","Aa","aa")))
p5 <- read_xlsx("data_mendel.xlsx", "P5", range = "A5:E9") %>%
mutate(Row = factor(Row, levels = c("2","1")),
P1 = factor(P1),
P2 = factor(P2, levels = c("A","a")),
XX = factor(XX, levels = c("AA","Aa","aa")))
p6 <- read_xlsx("data_mendel.xlsx", "P6", range = "A7:E23") %>%
mutate(Row = factor(Row, levels = c("4","3","2","1")),
P1 = factor(P1, levels = c("AB","Ab","aB","ab")),
P2 = factor(P2, levels = c("AB","Ab","aB","ab")),
XXXX = factor(XXXX, levels = c("AABB","AABb","AAbb","AaBB","AaBb",
"Aabb","aaBB","aaBb","aabb")))Seeds from 10 F2 plants
Plotting Function
# Create plotting function
ggMendel1 <- function(xx = d1 %>% filter(Expt == 1),
myTitle = NULL,
myColors = c("steelblue", "darkred")) {
# Prep data
xx <- xx %>%
arrange(desc(Trait)) %>%
group_by(Plant) %>%
mutate(Percentage = 100 * Seeds / sum(Seeds),
Cummulative_P = cumsum(Percentage),
Label_y = Cummulative_P - (Percentage / 2),
Plant = paste("F2 Plant", Plant),
`Total Seeds` = paste(`Total Seeds`, "Seeds")) %>%
mutate(Plant = factor(Plant, levels = unique(.$Plant)),
`Total Seeds` = factor(`Total Seeds`, levels = unique(.$`Total Seeds`)))
# Plot
ggplot(xx, aes(x = 1)) +
geom_col(aes(y = Percentage, fill = Trait),
color = "black", alpha = 0.7) +
coord_polar("y", start = 0) +
facet_wrap(Plant ~ ., ncol = 6) +
geom_label(aes(label = paste(round(Percentage), "%"), y = Label_y),
size = 2, label.padding = unit(0.1, "lines")) +
theme_agData_pie(legend.position = "bottom",
plot.caption = element_text(size = 7)) +
xlim(0.542, 1.45) +
scale_fill_manual(name = NULL, values = myColors) +
labs(title = myTitle, caption = myCaption2)
}Seeds From F2 Plants
# Create plotting function
ggMendel2 <- function(xx = d2 %>% filter(Expt == 1),
myColors = c("steelblue", "darkred")) {
# Prep data
xx <- xx %>% arrange(desc(Trait)) %>%
mutate(Percentage = 100 * Seeds / sum(Seeds),
Cummulative_P = cumsum(Percentage),
Label_y = Cummulative_P - (Percentage / 2))
# Plot
ggplot(xx, aes(x = 1)) +
geom_col(aes(y = Percentage, fill = Trait),
color = "black", alpha = 0.7) +
coord_polar("y", start = 1.57) +
geom_label(aes(label = paste(round(Percentage), "%"), y = Label_y)) +
facet_grid(. ~ paste(sum(Seeds), "Seed from", unique(`F2 Plants`), "F1 Plants")) +
theme_agData_pie(legend.position = "bottom",
plot.caption = element_text(size = 7)) +
xlim(0.542, 1.45) +
scale_fill_manual(name = NULL, values = myColors)
}
# Plot
mp1 <- ggplot(p2, aes(x = Col, y = Row, label = XX, fill = XX)) +
geom_tile(color = "black", alpha = 0.7) +
geom_text(size = 10) +
scale_x_continuous(breaks = 1:2, labels = c("A","a"), expand = c(0,0),
sec.axis = sec_axis(~ .,breaks = 1:2, labels = c("A","a"))) +
scale_y_discrete(breaks = c("1","2"), labels = c("A","a"), expand = c(0,0)) +
scale_fill_manual(values = c("darkorange", "darkgoldenrod2", "darkgreen")) +
theme_agData_pie() +
theme(legend.position = "none",
strip.placement = "outside",
axis.text = element_text(size = 25),
axis.text.x.bottom = element_blank(),
axis.ticks.x.bottom = element_blank(),
plot.margin = unit(c(1,1,2,1), "cm")) + #TRBL
labs(title = "", x = "", y = "", caption = "")
mp2 <- ggMendel2(xx = d2 %>% filter(Expt == 1), myColors = c("steelblue", "darkred"))
mp3 <- ggMendel2(xx = d2 %>% filter(Expt == 2), myColors = c("darkorange", "darkgreen"))
mp4 <- ggMendel2(xx = d2 %>% filter(Expt == 3), myColors = c("darkred", "grey"))
mp5 <- ggMendel2(xx = d2 %>% filter(Expt == 4), myColors = c("grey70", "grey30"))
mp6 <- ggMendel2(xx = d2 %>% filter(Expt == 5), myColors = c("darkgoldenrod2", "darkgreen"))
mp7 <- ggMendel2(xx = d2 %>% filter(Expt == 6), myColors = c("purple3", "palevioletred"))
mp8 <- ggMendel2(xx = d2 %>% filter(Expt == 7), myColors = c("steelblue", "darkblue"))
#
#
mp <- ggarrange(mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, ncol = 4, nrow = 2) %>%
annotate_figure(top = text_grob("Seed from Mendels 7 Experiments",
hjust = 0.9, size = 30, lineheight = 2),
bottom = text_grob(myCaption2, hjust = 0))
ggsave("mendel_03.png", mp, width = 12, height = 8.5, bg = "white") Chi-Square Tests
Chi-Square test: \(chi^2=\sum{\frac{(O-E)^2}{E}}\)
Seeds from F2 plants
xx <- d2 %>% filter(Expt == "1")
xx
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 1 253 7324 Round Seeds 5474 5493 0.75
## 2 1 253 7324 Wrinkled Seeds 1850 1831 0.25
((xx$Seeds[1]- xx$Expected[1])^2 / xx$Expected[1]) +
((xx$Seeds[2]- xx$Expected[2])^2 / xx$Expected[2])
## [1] 0.26288
chisq.test(x = xx$Seeds, p = xx$Predicted)
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.26288, df = 1, p-value = 0.6081## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 2 258 8023 Yellow Cotyledons 6022 6017. 0.75
## 2 2 258 8023 Green Cotyledons 2001 2006. 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.014999, df = 1, p-value = 0.9025
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 3 929 929 Violet-Red Flowers 705 697. 0.75
## 2 3 929 929 White Flowers 224 232. 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.39074, df = 1, p-value = 0.5319
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 4 1181 1181 Inflated Pods 882 886. 0.75
## 2 4 1181 1181 Constricted Pods 299 295. 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.063506, df = 1, p-value = 0.801
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 5 580 580 Green Pods 428 435 0.75
## 2 5 580 580 Yellow Pods 152 145 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.45057, df = 1, p-value = 0.5021
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 6 858 858 Axial Inflorescence 651 644. 0.75
## 2 6 858 858 Terminal Inflorescence 207 214. 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.34965, df = 1, p-value = 0.5543
## # A tibble: 2 × 7
## Expt `F2 Plants` `Total Seeds` Trait Seeds Expected Predicted
## <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 7 1064 1064 Long Stems 787 798 0.75
## 2 7 1064 1064 Short Stems 277 266 0.25
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.60652, df = 1, p-value = 0.4361
Seeds from 10 F2 plants
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.47368, df = 1, p-value = 0.4913
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.085714, df = 1, p-value = 0.7697
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.096774, df = 1, p-value = 0.7557
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 8.0095, df = 1, p-value = 0.004653
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.0077519, df = 1, p-value = 0.9298
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.66667, df = 1, p-value = 0.4142
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.7619, df = 1, p-value = 0.3827
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.66667, df = 1, p-value = 0.4142
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.98039, df = 1, p-value = 0.3221
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 0.16667, df = 1, p-value = 0.6831
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 10.141, df = 1, p-value = 0.00145
##
## Chi-squared test for given probabilities
##
## data: xx$Seeds
## X-squared = 11.046, df = 1, p-value = 0.0008888
Seeds From F2 x F1
# Plot punnet squares
mp1 <- ggplot(p4, aes(x = Col, y = Row, label = XX, fill = XX)) +
geom_tile(color = "black", alpha = 0.7) +
geom_text(size = 10) +
scale_x_continuous(breaks = 1:2, labels = c("A","A"), expand = c(0,0),
sec.axis = sec_axis(~ ., breaks = 1:2, labels = c("A","A"))) +
scale_y_discrete(breaks = c("1","2"), labels = c("A","a"), expand = c(0,0)) +
scale_fill_manual(values = c("darkorange","darkgoldenrod2")) +
theme_agData_pie() +
theme(legend.position = "none",
strip.placement = "outside",
axis.text = element_text(size = 25),
axis.text.x.bottom = element_blank(),
axis.ticks.x.bottom = element_blank(),
plot.margin = unit(c(0.5,0,0.5,5), "cm")) + #TRBL
labs(x = NULL, y = NULL)
mp2 <- ggplot(p2, aes(x = Col, y = Row, label = XX, fill = XX)) +
geom_tile(color = "black", alpha = 0.7) +
geom_text(size = 10) +
scale_x_continuous(breaks = 1:2, labels = c("A","a"), expand = c(0,0),
sec.axis = sec_axis(~ ., breaks = 1:2, labels = c("A","a"))) +
scale_y_discrete(breaks = c("1","2"), labels = c("A","a"), expand = c(0,0)) +
scale_fill_manual(values = c("darkorange", "darkgoldenrod2", "darkgreen")) +
theme_agData_pie() +
theme(legend.position = "none",
strip.placement = "outside",
axis.text = element_text(size = 25),
axis.text.x.bottom = element_blank(),
axis.ticks.x.bottom = element_blank(),
plot.margin = unit(c(0.5,2.5,0.5,2.5), "cm")) + #TRBL
labs(x = NULL, y = NULL)
mp3 <- ggplot(p5, aes(x = Col, y = Row, label = XX, fill = XX)) +
geom_tile(color = "black", alpha = 0.7) +
geom_text(size = 10) +
scale_x_continuous(breaks = 1:2, labels = c("a","a"), expand = c(0,0),
sec.axis = sec_axis(~ ., breaks = 2:1, labels = c("a","a"))) +
scale_y_discrete(breaks = c("1","2"), labels = c("A","a"), expand = c(0,0)) +
scale_fill_manual(values = c("darkgoldenrod2", "darkgreen")) +
theme_agData_pie() +
theme(legend.position = "none",
strip.placement = "outside",
axis.text = element_text(size = 25),
axis.text.x.bottom = element_blank(),
axis.ticks.x.bottom = element_blank(),
plot.margin = unit(c(0.5,5,0.5,0), "cm")) + #TRBL
labs(x = NULL, y = NULL)
mp1 <- ggarrange(mp1, mp2, mp3, ncol = 3)
# Create plotting function
ggMendel3 <- function(xx = d3 %>% filter(Expt == 1),
myColors = c("steelblue", "darkred")) {
# Prep data
xx <- xx %>% arrange(desc(Trait)) %>%
mutate(Percentage = 100 * Plants / sum(Plants),
Cummulative_P = cumsum(Percentage),
Label_y = Cummulative_P - (Percentage / 2))
# Plot
ggplot(xx, aes(x = 1)) +
geom_col(aes(y = Percentage, fill = Trait),
color = "black", alpha = 0.7) +
coord_polar("y", start = 0) +
geom_label(aes(label = paste(round(Percentage), "%"), y = Label_y)) +
facet_grid(. ~ paste(sum(Plants), "Plants")) +
theme_agData_pie(legend.position = "bottom",
plot.caption = element_text(size = 7)) +
xlim(0.542, 1.45) +
guides(fill = guide_legend(ncol = 1)) +
scale_fill_manual(name = NULL, values = myColors)
}
# Plot
mp2 <- ggMendel3(xx = d3 %>% filter(Expt == "1"), myColors = c("steelblue", "darkred"))
mp3 <- ggMendel3(xx = d3 %>% filter(Expt == "2"), myColors = c("darkgreen", "darkorange"))
mp4 <- ggMendel3(xx = d3 %>% filter(Expt == "3"), myColors = c("darkred", "grey"))
mp5 <- ggMendel3(xx = d3 %>% filter(Expt == "4"), myColors = c("grey70", "grey30"))
mp6 <- ggMendel3(xx = d3 %>% filter(Expt == "5a"), myColors = c("darkgreen", "darkgoldenrod2"))
mp7 <- ggMendel3(xx = d3 %>% filter(Expt == "5b"), myColors = c("darkgreen", "darkgoldenrod2"))
mp8 <- ggMendel3(xx = d3 %>% filter(Expt == "6"), myColors = c("purple3", "palevioletred"))
mp9 <- ggMendel3(xx = d3 %>% filter(Expt == "7"), myColors = c("steelblue", "darkblue"))
mp <- ggarrange(mp1, ggarrange(mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9, ncol = 4, nrow = 2),
ncol = 1, nrow = 2, heights = c(1,3)) %>%
annotate_figure(top = text_grob("Plants from Mendels 7 Experiments",
hjust = 0.9, size = 30, lineheight = 2),
bottom = text_grob(myCaption2, hjust = 0))
ggsave("mendel_04.png", mp, width = 12, height = 10, bg = "white") Chi-Square Tests
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 1 565 Only Round Seeds 193 188. 0.333
## 2 1 565 Round or Wrinkled Seeds 372 377. 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.18783, df = 1, p-value = 0.6647
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 2 519 Only Yellow Cotyledons 166 173. 0.333
## 2 2 519 Yellow or Green Cotyledons 353 346. 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.40432, df = 1, p-value = 0.5249
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 3 100 Only Grey-Brown Seed Coats 36 33.3 0.333
## 2 3 100 Grey-Brown or White Seed Coats 64 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.32821, df = 1, p-value = 0.5667
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 4 100 Only Inflated Pods 29 33.3 0.333
## 2 4 100 Inflated or Constricted Pods 71 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.83247, df = 1, p-value = 0.3616
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 5a 100 Only Green Pods 40 33.3 0.333
## 2 5a 100 Green or Yellow Pods 60 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 2.0211, df = 1, p-value = 0.1551
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 5b 100 Only Green Pods 35 33.3 0.333
## 2 5b 100 Green or Yellow Pods 65 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.13012, df = 1, p-value = 0.7183
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 6 100 Only Axial Inflorescence 33 33.3 0.333
## 2 6 100 Axial or Terminal Inflorescence 67 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 0.004052, df = 1, p-value = 0.9492
## # A tibble: 2 × 6
## Expt F3 Trait Plants Expected Predicted
## <chr> <dbl> <fct> <dbl> <dbl> <dbl>
## 1 7 100 Only Long Stems 28 33.3 0.333
## 2 7 100 Long or Short Stems 72 66.7 0.667
##
## Chi-squared test for given probabilities
##
## data: xx$Plants
## X-squared = 1.2647, df = 1, p-value = 0.2608
Two Genes
# Prep data
myPal <- colorRampPalette(c("darkorange", "darkgreen"))
myCols <- myPal(9)
# Plot
mp <- ggplot(p6, aes(x = Col, y = Row, label = XXXX, fill = XXXX)) +
geom_tile(color = "black", alpha = 0.7) +
geom_text(size = 10) +
scale_x_continuous(breaks = 1:4,
labels = c("ab","aB","Ab","AB"), expand = c(0,0),
sec.axis = sec_axis(~ ., breaks = 4:1,
labels = c("ab","aB","Ab","AB"))) +
scale_y_discrete(breaks = c("4","3","2","1"), labels = c("ab","aB","Ab","AB"), expand = c(0,0)) +
scale_fill_manual(values = myCols) +
theme_agData_pie() +
theme(legend.position = "none",
strip.placement = "outside",
axis.text = element_text(size = 25),
axis.text.x.bottom = element_blank(),
axis.ticks.x.bottom = element_blank()) +
labs(x = NULL, y = NULL)
ggsave("mendel_05.png", mp, width = 6, height = 3)